<?php
/**
 * XuYuan Project
 *
 * @package	XueYuan 
 * @author	Jiuchi Team
 * @since	Version 1.0.0
 * @filesource
 */
defined('BASEPATH') OR exit('No direct script access allowed');
/**
 * Login view
 * @author Wayne Yu
 */
?>
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">

<head>
    <?php $this->load->view('common/head');?>
	<!-- Page special css -->
    <link rel="stylesheet" type="text/css" href="/assets/css/index.css">
    <link rel="stylesheet" type="text/css" href="/assets/css/mycenter.css">
    <link rel="stylesheet" type="text/css" href="/assets/css/mycircle.css">
    <link rel="stylesheet" type="text/css" href="/assets/css/jquery.fancybox.css">
</head>
<body>
    <div class="navigation">
        <?php $this->load->view('common/navigation');?> 
    </div>
    <div class="wrapper">
        <div class="main-content">
            <div class="main-content-inner">
                <div class="home-list-title" style="font-weight: normal;color: #999;">
                    <span class="pointer" onclick="window.location = '<?php echo site_url('circle/view/'.$topicInfo['circle_id'])?>'">&lt&lt&nbsp返回圈子</span>
                </div>
                <div class="home-list">
                    <div>
                        <div id="topicDetails" class="home-list-content clearfix">
                            <ul id="commentsMore">
                                <li>
                                    <div class="rep">
                                        <div class="rep-header clearfix">
                                            <div class="rep-avatar">
                                                <a href="<?php echo site_url('user/view/'.$userInfo['id'])?>">
                                                	<img style="width:40px;" src="<?php echo $userInfo['headportrait']?>" class="img-avatar">
                                                </a>
                                            </div>
                                            <div class="rep-note">
                                                <span class="rep-auth-src"><a href="<?php echo site_url('user/view/'.$userInfo['id'])?>"><?php echo $userInfo['nickname']?></a></span>&nbsp<span class="rep-catalog text-small">发表的话题</span>
                                                <div class="rep-title ellipsis"><?php echo $topicInfo['title']?></div>
                                            </div>
                                            <div id="btnCellection" class="btn-cellection btn-blue">收藏</div>
                                        </div>
                                        <div class="rep-content-wrapper clearfix">
                                            <div class="rep-content clearfix">
                                            	<?php if($topicInfo['topic_img']){?>
	                                                <div class="fl" style="max-width:100%;margin: 0 10px 5px 0;">
	                                                    <img src="<?php echo $topicInfo['topic_img']?>" class="img-rep" style="max-width: 100%;vertical-align: middle;">
	                                                </div>
                                                <?php }?>
                                                <div class="rep-comment fl"><?php echo htmlspecialchars_decode($topicInfo['content'])?></div>
                                            </div>
                                        </div>
                                        <div class="rep-footer text-small clearfix">
                                            <div class="rep-time"><?php echo $this->user_dynamic_model->getTimeFormat(strtotime($topicInfo['created_at']))?></div>
                                            <a href="#addcomments"><div id="addComment" class="add-comment fl" style="margin-left: 50px;color:#0072dc;cursor: pointer;">添加评论</div></a>
                                        </div>
                                    </div>
                                </li>
                                <li class="comment-item">
                                    <div class="rep bd-top">
                                        <div class="rep-header clearfix">
                                            <div class="headportrait" style="width: 28px;height: 28px;background: black;position: absolute;margin-left: 5px;">
                                            </div>
                                            <div class="rep-note" style="line-height: 20px;">
                                                <i class="iconfont"></i>
                                                <span class="rep-auth-src name" style="margin-left: 48px;"></span>&nbsp<span class="rep-catalog text-small">的评论</span>
                                            </div>
                                        </div>
                                        <div class="rep-content-wrapper clearfix">
                                        	<div class="rep-img comment_photo" style="margin-left:50px;margin-top:20px;"></div>
                                            <div class="rep-content">
                                                <div class="rep-comment content">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="rep-footer text-small clearfix">
                                            <div id="addComment" class="add-comment fl viewbutton" style="margin-left: 50px;cursor: pointer;"></div>
                                            <span class="navmessage-title-icon" style="margin-left: 10px;display: inline-block;width: 20px;height:20px;background-position: -215px -90px;"></span>
                                            <span></span>
                                            <div class="rep-time"></div> 
                                        </div>
                                    </div>
                                </li>
                                <a href="javascript:" class="btn-white btn-more" id="btn-more-comment">查看更多</a>
                                <div id="addcomments" class="area-publish clearfix" style="margin-top: 20px;">
                                	<form action="<?php echo site_url('comment/createPost/'.$topicInfo['id'])?>" method="post">
                                      <textarea name="content" style="width: 100%;height: 60px;border-radius: 6px;"></textarea>
                                      <input type="submit" class="btn-publish" style="width: 60px;height: 30px;background: #0072dc;color: #FFFFFF;padding:0px 5px;line-height: 30px;float: right;border-radius: 5px;text-align: center;cursor: pointer;" value="发布"></form>
                                </div>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="footer">
        <?php $this->load->view('common/footer');?>
    </div>
	<script type="text/javascript" src="/assets/js/jquery.more.js"></script>
    <script>
    $(document).ready(function() {
        $('#btnCellection').click(function () {
            var btnStaus=$('#btnCellection').text();
            if(btnStaus=="收藏"){
                 $(this).toggleClass("btn-cellection-cancel").text("已收藏");                
            }else{
                $(this).toggleClass("btn-cellection-cancel").text("收藏"); 
            }     
        });
        
        $('#commentsMore').more({
            'address': '<?php echo site_url('topic/getTopicComments/'.$topicInfo['id'])?>',
            'template': '.comment-item',
            'trigger': '#btn-more-comment'
        });

        $(".comment_photo img").fancybox({
            'transitonIn' : 'elastic',
            'transitonOut' : 'elastic',
            'speedIn' : 600,
            'speedOut' : 200,
            'overlayShow' :false,    
        })
    });
    </script>

</body>
</html>

